﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace ST.Buz.Base.Entity
{
	/// <summary>
	/// oauth登录信息
	/// </summary>
	[Serializable]
	[Table("Sys_OAuth")]
	public partial class Sys_OAuth
	{
		/// <summary>
		/// ID
		/// </summary>
		[Key]
		[Column("ID")]
		public int ID { get; set; }

		/// <summary>
		/// AppID
		/// </summary>
		[Column("AppID")]
		[StringLength(32, ErrorMessage = "{0}长度不能超过{1}")]
		public string AppID { get; set; }

		/// <summary>
		/// OAuth类型（微博、微信、QQ）
		/// </summary>
		[Column("Type")]
		public int Type { get; set; }

		/// <summary>
		/// 系统用户ID
		/// </summary>
		[Column("UserID")]
		public int UserID { get; set; }

		/// <summary>
		/// UnionID
		/// </summary>
		[Column("UnionID")]
		[StringLength(128, ErrorMessage = "{0}长度不能超过{1}")]
		public string UnionID { get; set; }

		/// <summary>
		/// OpenID
		/// </summary>
		[Required]
		[Column("OpenID")]
		[StringLength(128, ErrorMessage = "{0}长度不能超过{1}")]
		public string OpenID { get; set; }

		/// <summary>
		/// 昵称
		/// </summary>
		[Column("NickName")]
		[StringLength(50, ErrorMessage = "{0}长度不能超过{1}")]
		public string NickName { get; set; }

		/// <summary>
		/// 性别（0：未知，1：男：2：女）
		/// </summary>
		[Column("Gender")]
		public int Gender { get; set; }

		/// <summary>
		/// 国家
		/// </summary>
		[Column("Country")]
		[StringLength(50, ErrorMessage = "{0}长度不能超过{1}")]
		public string Country { get; set; }

		/// <summary>
		/// 省
		/// </summary>
		[Column("Province")]
		[StringLength(50, ErrorMessage = "{0}长度不能超过{1}")]
		public string Province { get; set; }

		/// <summary>
		/// 市
		/// </summary>
		[Column("City")]
		[StringLength(50, ErrorMessage = "{0}长度不能超过{1}")]
		public string City { get; set; }

		/// <summary>
		/// 区、县
		/// </summary>
		[Column("District")]
		[StringLength(50, ErrorMessage = "{0}长度不能超过{1}")]
		public string District { get; set; }

		/// <summary>
		/// 乡镇、街道
		/// </summary>
		[Column("Town")]
		[StringLength(50, ErrorMessage = "{0}长度不能超过{1}")]
		public string Town { get; set; }

		/// <summary>
		/// 详细地址
		/// </summary>
		[Column("DetailAddress")]
		[StringLength(100, ErrorMessage = "{0}长度不能超过{1}")]
		public string DetailAddress { get; set; }

		/// <summary>
		/// 头像
		/// </summary>
		[Column("AvatarUrl")]
		[StringLength(200, ErrorMessage = "{0}长度不能超过{1}")]
		public string AvatarUrl { get; set; }

		/// <summary>
		/// 授权状态（是否已获取基本信息）
		/// </summary>
		[Column("Authorized")]
		public bool Authorized { get; set; }

		/// <summary>
		/// 是否已订阅
		/// </summary>
		[Column("Subscribed")]
		public bool Subscribed { get; set; }

		///// <summary>
		///// 订阅时间
		///// </summary>
		//[Column("SubscribeTime")]
		//public DateTime SubscribeTime { get; set; }

		/// <summary>
		/// Session Key
		/// </summary>
		[Column("SessionKey")]
		[StringLength(200, ErrorMessage = "{0}长度不能超过{1}")]
		public string SessionKey { get; set; }

		/// <summary>
		/// 关联的公众号授权ID
		/// </summary>
		[Column("RelatedOAuthID")]
		public int RelatedOAuthID { get; set; }

		/// <summary>
		/// 绑定时间
		/// </summary>
		[Column("AddDate")]
		public DateTime AddDate { get; set; }

		/// <summary>
		/// 最后更新时间
		/// </summary>
		[Column("LastUpdate")]
		public DateTime LastUpdate { get; set; }

		/// <summary>
		/// 最后访问时间
		/// </summary>
		[Column("LastVisit")]
		public DateTime LastVisit { get; set; }

		/// <summary>
		/// 最后访问IP
		/// </summary>
		[Column("LastVisitIP")]
		[StringLength(40, ErrorMessage = "{0}长度不能超过{1}")]
		public string LastVisitIP { get; set; }
	}
}
